package meterMonitor.controller;

import meterMonitor.consts.ResponseCode;
import meterMonitor.framework.auth.AuthorityType;
import meterMonitor.framework.auth.FireAuthority;
import meterMonitor.mapper.*;
import meterMonitor.model.*;
import meterMonitor.vo.BaseResponseData;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.xml.crypto.Data;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

/**
 * Created by Administrator on 2019/1/13 0013.
 */
@RequestMapping("waterChart")
@RestController
public class WaterChartController extends BaseController {
    public static final Logger logger = LoggerFactory.getLogger(WaterChartController.class);

    @Autowired
    MonitorDetailMapper monitorDetailMapper;
    @Autowired
    MonitorDayMapper monitorDayMapper;
    @Autowired
    MonitorWeekMapper monitorWeekMapper;
    @Autowired
    MonitorMonthMapper monitorMonthMapper;
    @Autowired
    MonitorYearMapper monitorYearMapper;
    @Autowired
    MeterMapper meterMapper;

    @RequestMapping("waterChartIndex.do")
    @FireAuthority(authorityTypes = AuthorityType.Query)
    private ModelAndView index(ModelAndView mv) {
        return mv;
    }
    //
    // @RequestMapping("queryForChart2.do")
    // @ResponseBody
    // @FireAuthority(authorityTypes = AuthorityType.Query)
    // public BaseResponseData queryForChart2(Integer chartType, String fromTime, String toTime, String meterCode) {
    //     BaseResponseData response = new BaseResponseData();
    //     if (null == meterCode || meterCode == "") {
    //         response.setCode(ResponseCode.DEFAULT_EXCEPTION);
    //         response.setMessage("请选择设备！");
    //         return response;
    //
    //     } else {
    //         List<Long> meterCodeList = new ArrayList<>();
    //         String[] split = meterCode.split(",");
    //         if (null == meterCodeList || meterCodeList.size() == 0) {
    //             response.setCode(ResponseCode.DEFAULT_EXCEPTION);
    //             response.setMessage("请选择设备！");
    //             return response;
    //         }
    //
    //
    //         switch (chartType) {
    //
    //
    //             // 日报（默认当日24个小时的数据，一个小时一条，可往前选3个月）
    //             case 1:
    //
    //                 List<MonitorDetail> monitorDetails = monitorDetailMapper.queryData(fromTime, toTime, meterCode);
    //
    //
    //                 break;
    //             // 周报（默认当周7天的数据，一天一条，可往前选2年）
    //             case 2:
    //                 break;
    //             // 月报（默认当月四周或者五周的数据，一周一条数据，可往前选2年）
    //             case 3:
    //                 break;
    //             // 年报（默认当年12个月的数据，一月一条数据，可以往前选2年）
    //             case 4:
    //                 break;
    //
    //         }
    //
    //
    //         return null;
    //     }
    // }



    @RequestMapping("queryForChart1.do")
    @ResponseBody
    @FireAuthority(authorityTypes = AuthorityType.Query)
    private BaseResponseData queryForChart1(String startTime,//开始时间
                                            String endTime,//结束时间
                                            String areaId,//区编号A/B
                                            String deviceTypeCode,
                                            String meterCodes,//Miter编码
                                            Integer repType) {//报告类型：周报；日报，，，
        BaseResponseData response = new BaseResponseData();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat sdf6 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataX= simpleDateFormat.format(new Date());
        DecimalFormat df = new DecimalFormat("#0.00");

        if(StringUtils.isBlank(deviceTypeCode)){
            response.setCode(ResponseCode.DEFAULT_EXCEPTION);
            response.setMessage("设备类型不能为空");
            return response;
        }
        int type=Integer.parseInt(deviceTypeCode);//将string类型转换为int
        try {
            List<Long> meterCodeList = new ArrayList<>();
            if (null == meterCodes || meterCodes == "") {
                List<Meter> meters = meterMapper.queryByAreaId(areaId);
                meterCodeList = meters.stream().map(Meter::getMeterCode).collect(Collectors.toList());
                if (null == meterCodeList || meterCodeList.size() == 0) {
                    response.setCode(ResponseCode.DEFAULT_EXCEPTION);
                    response.setMessage("当前区域下没有绑定设备！");
                    return response;
                }
            } else {
                String[] split = meterCodes.split(",");
                for (String code : split) {
                    meterCodeList.add(Long.parseLong(code));
                }
                if (null == meterCodeList || meterCodeList.size() == 0) {
                    response.setCode(ResponseCode.DEFAULT_EXCEPTION);
                    response.setMessage("请选择设备！");
                    return response;
                }
            }
            Map<String, Object> detail = new LinkedHashMap<>();
            Map<String, Double> total = new LinkedHashMap<>();
            Map<String, Double> total1 = new LinkedHashMap<>();
            List<String> dates = new ArrayList<>();
            SimpleDateFormat sdf = null;
            switch (repType) {
                // 日报（详情）
                case 2:
                    String dataY=startTime.substring(0,10);
                    String endTime1=null;
                    if (dataX.equals(dataY)){
                        endTime1=sdf6.format(new Date());
                    }else{
                        endTime1=endTime;
                    }
                    double totalStandard=0d;



                    Calendar start = Calendar.getInstance();
                    start.setTime(sdf6.parse(startTime));
                    Date date=sdf6.parse(endTime1);
                    Calendar end =Calendar.getInstance();
                    end.setTime(date);
                    end.add(Calendar.MINUTE,-10);

                    List<MonitorDetail> monitorDetails = null;
                    Double sum2=0d;
                    String detailDate=null;

                    String detailDate1=null;


                    long startTimey=System.currentTimeMillis(); //获取开始时间

                    while (start.getTimeInMillis() <= end.getTimeInMillis()) {
                        //将一天的时间分成十分钟段
                        monitorDetails = new ArrayList<>();
                        sum2 = 0D;
                        detailDate=sdf6.format(start.getTime());
                        // dates.add(sdf6.format(start.getTime()));
                        start.add(Calendar.MINUTE, 10);
                        detailDate1=sdf6.format(start.getTime());


                        //Calendar.MINUTE, 10
                        MonitorDetail monitorDetail=null;
                        List<MonitorDetail> monitorDetailList=new ArrayList<>();


                        monitorDetail = new MonitorDetail();
                        //将时间段设置到monitorDetail中
                        monitorDetail.setDetailDate(detailDate);
                        monitorDetail.setDetailDateAdd1(detailDate1);
                        //将仪器编号也设置到monitorDetail中
                        monitorDetail.setMeterCodes(meterCodes);
                        monitorDetail.setDeviceTypeCode(type);


                        //根据设备类型和仪器编号查出对应仪器此时时间段的数据
                        long startTimez=System.currentTimeMillis(); //获取开始时间
                        monitorDetailList = monitorDetailMapper.queryOneWaterElectricity(monitorDetail);
                        long endTimez=System.currentTimeMillis(); //获取结束时间
                        System.out.println("1103:::： "+(endTimez-startTimez)+"ms");


                        long startTimex=System.currentTimeMillis(); //获取开始时间
                        for (Long meterCode : meterCodeList) {
                            for (MonitorDetail monitorDetail1 : monitorDetailList) {
                                if (monitorDetail1.getMeterCode()==meterCode){

                                    try {
                                        if (Objects.nonNull(monitorDetail1.getIntervalQuantity())) {
                                            //统计仪器的间隔使用量
                                            sum2 =  monitorDetail1.getIntervalQuantity();
                                        }
                                        //将仪器对 应的日标准量除以24得到小时标准量，可能会产生空值异常
                                        monitorDetail1.setStandard(Double.valueOf(df.format(monitorDetail1.getStandard() / 144)));

                                        monitorDetail1.setUploadTime(monitorDetail1.getUploadTime());

                                        monitorDetail1.setDetailDate(detailDate1);

                                        monitorDetail1.setStandardSum(monitorDetail1.getSpec());
                                        monitorDetail1.setIntervalQuantitySum(monitorDetail1.getElectricQty());

                                        monitorDetails.add(monitorDetail1);
                                    } catch (Exception e) {
                                        e.printStackTrace();
                                    }
                                }
                            }





                        }
                        long endTimex=System.currentTimeMillis(); //获取结束时间

                        System.out.println("1104:::： "+(endTimex-startTimex)+"ms");


                        // Double sum = monitorDetails.size() == 0 ? null : monitorDetails.stream().mapToDouble(MonitorDetail::getIntervalQuantity).sum();
                        detail.put(detailDate1, monitorDetails);
                        total.put(detailDate1, Double.valueOf(df.format(sum2)));
                    }
                    long endTimey=System.currentTimeMillis(); //获取结束时间

                    System.out.println("1105:::： "+(endTimey-startTimey)+"ms");

//


                    break;
                // 周（七天的数据）
                case 3:
                    if (type==1){
                        SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd");
                        Calendar start1 = Calendar.getInstance();
                        start1.setTime(sdf3.parse(startTime));
                        Calendar end1 = Calendar.getInstance();
                        end1.setTime(sdf3.parse(endTime));

                        while (start1.getTimeInMillis() <= end1.getTimeInMillis()) {
                            dates.add(sdf3.format(start1.getTime()));
                            start1.add(Calendar.DAY_OF_MONTH, 1);
                        }
                        List<MonitorDay> monitorDays = null;
                        List<Double> countList=new ArrayList<>();
                        int count=0;
                        for (String day : dates) {
                            monitorDays = new ArrayList<>();
                            Double sum3 = 0D;
                            Double sum4 = 0D;
                            Double sum5 = 0D;
                            for (Long meterCode : meterCodeList) {
                                MonitorDay monitorDay = new MonitorDay();
                                MonitorDay monitorDay1 = new MonitorDay();
                                monitorDay.setDay(day);
                                monitorDay.setMeterCode(meterCode);
                                monitorDay1=monitorDay;
                                monitorDay1.setDayStart(startTime);
                                monitorDay = monitorDayMapper.queryOneWater(monitorDay);
                                try {
                                    if (Objects.nonNull(monitorDay.getIntervalQuantity())) {
                                        sum3 += monitorDay.getIntervalQuantity();
                                    }
                                    List<MonitorDay> list = monitorDayMapper.queryOneWater1(monitorDay1);
                                    for (MonitorDay monitorDay2 : list) {
                                        sum4+=monitorDay2.getSpec();
                                        sum5+=monitorDay2.getIntervalQuantity();
                                    }
                                    monitorDay.setStandardSum(Double.valueOf(df.format(sum4)));
                                    monitorDay.setIntervalQuantitySum(Double.valueOf(df.format(sum5)));
                                    sum4 = 0D;
                                    sum5 = 0D;
                                    monitorDays.add(monitorDay);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                            }
                            // Double sum = monitorDays.size() == 0 ? null : monitorDays.stream().mapToDouble(MonitorDay::getIntervalQuantity).sum();
                            detail.put(day, monitorDays);
                            total.put(day, Double.valueOf(df.format(sum3)));
                        }
                    }else if(type==0){
                        SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd");
                        Calendar start1 = Calendar.getInstance();
                        start1.setTime(sdf3.parse(startTime));
                        Calendar end1 = Calendar.getInstance();
                        end1.setTime(sdf3.parse(endTime));
                        while (start1.getTimeInMillis() <= end1.getTimeInMillis()) {
                            dates.add(sdf3.format(start1.getTime()));
                            start1.add(Calendar.DAY_OF_MONTH, 1);
                        }

                        List<MonitorDay> monitorDays = null;
                        for (String day : dates) {
                            monitorDays = new ArrayList<>();
                            Double sum3 = 0D;
                            Double sum4 = 0D;
                            Double sum5 = 0D;
                            for (Long meterCode : meterCodeList) {
                                MonitorDay monitorDay = new MonitorDay();
                                MonitorDay monitorDay1 = new MonitorDay();
                                monitorDay.setDay(day);
                                monitorDay.setMeterCode(meterCode);
                                monitorDay1=monitorDay;
                                monitorDay1.setDayStart(startTime);
                                monitorDay = monitorDayMapper.queryOneElectricity(monitorDay);



                                try {
                                    if (Objects.nonNull(monitorDay.getIntervalQuantity())) {
                                        sum3 += monitorDay.getIntervalQuantity();
                                    }

                                    List<MonitorDay> list = monitorDayMapper.queryOneElectricity1(monitorDay1);
                                    for (MonitorDay monitorDay2 : list) {
                                        sum4+=monitorDay2.getSpec();
                                        sum5+=monitorDay2.getIntervalQuantity();
                                    }
                                    monitorDay.setStandardSum(Double.valueOf(df.format(sum4)));
                                    monitorDay.setIntervalQuantitySum(Double.valueOf(df.format(sum5)));
                                     sum4 = 0D;
                                     sum5 = 0D;
                                    monitorDays.add(monitorDay);

                                } catch (Exception e) {
                                    e.printStackTrace();
                                }

                            }
                            // Double sum = monitorDays.size() == 0 ? null : monitorDays.stream().mapToDouble(MonitorDay::getIntervalQuantity).sum();
                            detail.put(day, monitorDays);
                            total.put(day, Double.valueOf(df.format(sum3)));
                        }
                    }
                    break;
                // 月报（当月第一天和最后一天）
                case 4:
                    if (type==1){
                        SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy-MM");
                        SimpleDateFormat sdf5 = new SimpleDateFormat("yyyy-MM-dd");
                        Calendar start2 = Calendar.getInstance();
                        start2.setTime(sdf4.parse(startTime));
                        Calendar end2 = Calendar.getInstance();
                        end2.setTime(sdf5.parse(endTime));

                        String week1 = start2.get(Calendar.YEAR) + (start2.get(Calendar.WEEK_OF_YEAR) < 10 ? "0" + start2.get(Calendar.WEEK_OF_YEAR) : start2.get(Calendar.WEEK_OF_YEAR) + "");

                        while (start2.getTimeInMillis() <= end2.getTimeInMillis()) {
                            String week = start2.get(Calendar.YEAR) + (start2.get(Calendar.WEEK_OF_YEAR) < 10 ? "0" + start2.get(Calendar.WEEK_OF_YEAR) : start2.get(Calendar.WEEK_OF_YEAR) + "");
                            dates.add(week);
                            start2.add(Calendar.WEEK_OF_MONTH, 1);
                        }

                        List<MonitorWeek> monitorWeeks = null;
                        sdf = new SimpleDateFormat("yyyy-MM-dd");
                        for (String week : dates) {
                            monitorWeeks = new ArrayList<>();
                            Double sum4 = 0D;
                            Double sum5 = 0D;
                            Double sum6 = 0D;

                            for (Long meterCode : meterCodeList) {
                                MonitorWeek monitorWeek = new MonitorWeek();
                                MonitorWeek monitorWeek1 = new MonitorWeek();
                                monitorWeek.setWeek(week);
                                monitorWeek.setMeterCode(meterCode);
                                monitorWeek1=monitorWeek;
                                monitorWeek1.setWeek1(week1);
                                monitorWeek = monitorWeekMapper.queryOneWater(monitorWeek);


                                try {
                                    if (Objects.nonNull(monitorWeek.getIntervalQuantity())) {
                                        sum4 += monitorWeek.getIntervalQuantity();
                                    }

                                    // 计算当月总天数
                                    Calendar instance = Calendar.getInstance();
                                    monitorWeek.setStandard(7 * monitorWeek.getStandard());


                                    List<MonitorWeek> monitorWeeks1 = monitorWeekMapper.queryOneWater1(monitorWeek1);
                                    for (MonitorWeek monitorWeek2 : monitorWeeks1) {
                                        sum5+=monitorWeek2.getSpec();
                                        sum6+=monitorWeek2.getIntervalQuantity();
                                    }

                                    monitorWeek.setStandardSum(Double.valueOf(df.format(sum5)));
                                    monitorWeek.setIntervalQuantitySum(Double.valueOf(df.format(sum6)));
                                     sum5 = 0D;
                                     sum6 = 0D;
                                    monitorWeeks.add(monitorWeek);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }


                            }
                            // Double sum = monitorWeeks.size() == 0 ? null : monitorWeeks.stream().mapToDouble(MonitorWeek::getIntervalQuantity).sum();
                            detail.put(week, monitorWeeks);
                            total.put(week, Double.valueOf( df.format(sum4)));
                        }
                    }else if(type==0){
                        SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy-MM");
                        SimpleDateFormat sdf5 = new SimpleDateFormat("yyyy-MM-dd");
                        Calendar start2 = Calendar.getInstance();
                        start2.setTime(sdf4.parse(startTime));
                        Calendar end2 = Calendar.getInstance();
                        end2.setTime(sdf5.parse(endTime));

                        String week1 = start2.get(Calendar.YEAR) + (start2.get(Calendar.WEEK_OF_YEAR) < 10 ? "0" + start2.get(Calendar.WEEK_OF_YEAR) : start2.get(Calendar.WEEK_OF_YEAR) + "");

                        while (start2.getTimeInMillis() <= end2.getTimeInMillis()) {
                            String week = start2.get(Calendar.YEAR) + (start2.get(Calendar.WEEK_OF_YEAR) < 10 ? "0" + start2.get(Calendar.WEEK_OF_YEAR) : start2.get(Calendar.WEEK_OF_YEAR) + "");
                            dates.add(week);
                            start2.add(Calendar.WEEK_OF_MONTH, 1);
                        }

                        List<MonitorWeek> monitorWeeks = null;
                        sdf = new SimpleDateFormat("yyyy-MM");
                        for (String week : dates) {
                            monitorWeeks = new ArrayList<>();
                            Double sum4 = 0D;
                            Double sum5 = 0D;
                            Double sum6 = 0D;
                            for (Long meterCode : meterCodeList) {
                                MonitorWeek monitorWeek = new MonitorWeek();
                                MonitorWeek monitorWeek1 = new MonitorWeek();
                                monitorWeek.setWeek(week);
                                monitorWeek.setMeterCode(meterCode);
                                monitorWeek1=monitorWeek;
                                monitorWeek1.setWeek1(week1);
                                monitorWeek = monitorWeekMapper.queryOneElectricity(monitorWeek);

                                try {
                                    if (Objects.nonNull(monitorWeek.getIntervalQuantity())) {
                                        sum4 += monitorWeek.getIntervalQuantity();
                                    }

                                    // 计算当月总天数
                                    Calendar instance = Calendar.getInstance();
                                    monitorWeek.setStandard(7 * monitorWeek.getStandard());


                                    List<MonitorWeek> monitorWeeks1 = monitorWeekMapper.queryOneElectricity1(monitorWeek1);
                                    for (MonitorWeek monitorWeek2 : monitorWeeks1) {
                                        sum5+=monitorWeek2.getSpec();
                                        sum6+=monitorWeek2.getIntervalQuantity();
                                    }

                                    monitorWeek.setStandardSum(Double.valueOf(df.format(sum5)));
                                    monitorWeek.setIntervalQuantitySum(Double.valueOf(df.format(sum6)));
                                    sum5 = 0D;
                                    sum6 = 0D;
                                    monitorWeeks.add(monitorWeek);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }


                            }
                            // Double sum = monitorWeeks.size() == 0 ? null : monitorWeeks.stream().mapToDouble(MonitorWeek::getIntervalQuantity).sum();
                            detail.put(week, monitorWeeks);
                            total.put(week,  Double.valueOf( df.format(sum4)));
                        }
                    }
                    break;
                case 5:
                    if (type==1){
                        SimpleDateFormat sdf5 = new SimpleDateFormat("yyyy");
                        Calendar start3 = Calendar.getInstance();
                        start3.setTime(sdf5.parse(startTime));
                        Calendar end3 = Calendar.getInstance();
                        end3.setTime(sdf5.parse(endTime));
                        while (start3.getTimeInMillis() <= end3.getTimeInMillis()) {
                            dates.add(sdf5.format(start3.getTime()));
                            start3.add(Calendar.YEAR, 1);
                        }
                        List<MonitorYear> monitorYears = null;
                        sdf = new SimpleDateFormat("yyyy");

                        for (String year : dates) {
                            monitorYears = new ArrayList<>();
                            Double sum5 = 0D;
                            for (Long meterCode : meterCodeList) {
                                MonitorYear monitorYear = new MonitorYear();
                                monitorYear.setYear(year);
                                monitorYear.setMeterCode(meterCode);
                                monitorYear = monitorYearMapper.queryOneWater(monitorYear);

                                try {
                                    if (Objects.nonNull(monitorYear.getIntervalQuantity())) {
                                        sum5 += monitorYear.getIntervalQuantity();
                                    }
                                    // 计算当年总天数
                                    Calendar instance = Calendar.getInstance();
                                    instance.setTime(sdf.parse(year));
                                    int years = instance.getActualMaximum(Calendar.DAY_OF_YEAR);
                                    monitorYear.setStandard(years * monitorYear.getStandard());
                                    monitorYear.setStandardSum(monitorYear.getSpec());
                                    monitorYear.setIntervalQuantitySum(monitorYear.getIntervalQuantity());
                                    monitorYears.add(monitorYear);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }

                            }
                            // Double sum = monitorYears.size() == 0 ? null : monitorYears.stream().mapToDouble(MonitorYear::getIntervalQuantity).sum();
                            detail.put(year, monitorYears);
                            total.put(year, Double.valueOf(df.format(sum5)));
                        }
                    }else if(type==0){
                        SimpleDateFormat sdf5 = new SimpleDateFormat("yyyy");
                        Calendar start3 = Calendar.getInstance();
                        start3.setTime(sdf5.parse(startTime));
                        Calendar end3 = Calendar.getInstance();
                        end3.setTime(sdf5.parse(endTime));
                        while (start3.getTimeInMillis() <= end3.getTimeInMillis()) {
                            dates.add(sdf5.format(start3.getTime()));
                            start3.add(Calendar.YEAR, 1);
                        }
                        List<MonitorYear> monitorYears = null;
                        sdf = new SimpleDateFormat("yyyy");

                        for (String year : dates) {
                            monitorYears = new ArrayList<>();
                            Double sum5 = 0D;
                            for (Long meterCode : meterCodeList) {
                                MonitorYear monitorYear = new MonitorYear();
                                monitorYear.setYear(year);
                                monitorYear.setMeterCode(meterCode);
                                monitorYear = monitorYearMapper.queryOneElectricity(monitorYear);

                                try {
                                    if (Objects.nonNull(monitorYear.getIntervalQuantity())) {
                                        sum5 += monitorYear.getIntervalQuantity();
                                    }
                                    // 计算当年总天数
                                    Calendar instance = Calendar.getInstance();
                                    instance.setTime(sdf.parse(year));
                                    int years = instance.getActualMaximum(Calendar.DAY_OF_YEAR);
                                    monitorYear.setStandard(years * monitorYear.getStandard());
                                    monitorYear.setStandardSum(monitorYear.getSpec());
                                    monitorYear.setIntervalQuantitySum(monitorYear.getIntervalQuantity());
                                    monitorYears.add(monitorYear);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }

                            }
                            // Double sum = monitorYears.size() == 0 ? null : monitorYears.stream().mapToDouble(MonitorYear::getIntervalQuantity).sum();
                            detail.put(year, monitorYears);
                            total.put(year, sum5);
                        }
                    }


                    break;
            }
            Map<String, Object> map = new HashMap<>();
            map.put("detail", detail);
            map.put("total", total);
            response.setData(map);
            response.setCode(ResponseCode.SUCCESS);
        } catch (Exception e) {
            logger.error("查询图表数据异常!", e);
            response.setCode(ResponseCode.DEFAULT_EXCEPTION);
            response.setMessage(e.getMessage() != null ? e.getMessage() : "系统异常！请联系管理员");
        }
        return response;
    }



}

